Skip to content

Scan reopened pull requests instead of passing them unscanned - #460

Merged
lelia merged 11 commits into
mainfrom
fix/scan-reopened-pull-requests
Nov 24, 2026
Merged

lelia merged 11 commits into
mainfrom
fix/scan-reopened-pull-requests

Conversation

@dc-larsen

@dc-larsen David Larsen (dc-larsen) commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

With --scm github, reopened pull requests and pull requests marked ready for review now follow the same comparison path as opened and synchronized pull requests.

  • Skipped GitHub events and GitLab pipeline sources warn when no scan ran and exit 0. GitHub warnings give specific guidance for missing event context, pull_request_target, and merge_group.
  • The GitHub Actions examples put the required socket-security check in a PR-only workflow. Separate workflows retain branch scans, default-branch baseline updates, and PR ignore commands.
  • The CI guide covers required check setup, migration from the combined workflow, fork PRs, and merge queues. A queue requires a check that evaluates the merge group commit.

Verification

  • The CLI regression tests read the action from GITHUB_EVENT_PATH. Reopened and ready-for-review PRs compare and exit 0 with a clean result or 1 with an existing blocker under --strict-blocking. The tests also verify the security comment for the blocker and confirm a closed PR runs neither scan path.
  • Test-org verification on the original patch exercised npm and PyPI pull requests with a real baseline and confirmed that reopened and ready-for-review runs compared and reported existing blockers. The revised workflow examples were checked locally with actionlint.

Release

Ships in 2.14.0. Merge order: #461 → #462 → #460 → #464 → #465 → #463. Merged together in that order on main at #459, the six pass the full test suite and ruff check. main requires branches to be up to date, so update each PR from main after the previous merge. CHANGELOG.md will conflict each time: combine the bullets under the existing ## 2.14.0 subsections (Upgrade notes, Changed, Fixed, Documentation) by hand rather than taking either side.

This is 3 of 6, after #462. Updating from main then conflicts in docs/ci-cd.md, in the paragraph after "Findings block only when a diff comparison runs". Keep this PR's sentence with the Skipped events link, followed by #461/#462's sentence: "The CLI treats comparisons marked incomplete or returned with missing or invalid package lists as infrastructure failures. With --strict-blocking, incomplete existing-alert data is also an infrastructure failure." The table below it merges cleanly.

Review focus: The PR job keeps the socket-security job name, so copying it to the existing workflow path leaves branch protection unchanged. The push workflow must be added in the same change, or default-branch baselines stop updating; the upgrade note and CI guide now say so.

Public Changelog

With --scm github, reopened pull requests and pull requests marked ready for review now run the PR scan. Skipped GitHub events and GitLab pipeline sources warn when no scan ran. The GitHub Actions examples put the PR check in a dedicated workflow.

Fixes: CE-512

With --scm github, a pull_request run whose action was not opened or
synchronize logged "Pull Request Action reopened is not a supported type"
and exited 0 without scanning. The example workflow subscribes to
reopened, and a required check takes the latest run on the head commit,
so reopening a pull request could replace a failed Socket check with a
pass on the same commit.

reopened and ready_for_review now run the same comparison as opened and
synchronize. Other actions and unhandled events are still skipped with
exit 0, as the exit-code contract documents, but log a warning that no
scan ran. pull_request_target gets its own message because it runs
against the base branch, so it is not treated as pull_request. GitLab's
unhandled pipeline sources log the same warning.
…'t scan

A missing pull_request action or GITHUB_EVENT_NAME (or CI_PIPELINE_SOURCE on
GitLab) now gets its own warning instead of "action 'None' is not scanned",
whose advice to drop the action from the workflow didn't apply. The skip
warnings list issue_comment as handling ignore commands, not as a scanned
event. Tests pin push, workflow_dispatch and issue_comment routing.
Move the Skipped events section below the scan-type paragraphs it had split.
State the required-check risk without claiming which run GitHub picks.
Explain that push on every branch also runs the job on a pull request's head
commit as a full scan that exits 0, and give two ways to keep that run from
satisfying a required check.
2.13.2 was released from main, so this change needs the next patch version.
@lelia
lelia marked this pull request as ready for review November 24, 2026 02:52
@lelia
lelia requested a review from a team as a code owner November 24, 2026 02:52
@lelia

lelia commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

bugbot run

@cursor

cursor Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes CI gating behavior for reopened/ready PRs and how skipped events report success; teams must migrate split workflows and align pull_request.types with required checks.

Overview
Release 2.14.0 expands when GitHub PR checks actually run and makes “no scan” visible in CI logs.

With --scm github, reopened and ready_for_review pull request actions now follow the same diff scan path as opened and synchronize, so re-opened or draft→ready PRs get a fresh comparison (including --strict-blocking on existing blockers). Unsupported GitHub events (closed, pull_request_target, merge_group, unknown actions, missing GITHUB_EVENT_NAME / action) and unrecognized GitLab pipeline sources exit 0 but log a warning that no scan ran, with guidance when a job is a required check.

The GitHub Actions examples are split: PR-only socket-security (github-actions.yml, now including ready_for_review), pushes/baselines (github-actions-push.yml), and ignore commands (github-actions-comments.yml). Docs describe migration and required-check pitfalls (merge queue, fork PRs).

Tests add test_github_event_filter.py covering action routing, skip warnings, and end-to-end exit codes for reopened/ready vs closed PRs.

Reviewed by Cursor Bugbot for commit a5b1c93. Configure here.

@lelia
lelia temporarily deployed to socket-firewall November 24, 2026 02:52 — with GitHub Actions Inactive

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a5b1c93. Configure here.

@lelia
lelia temporarily deployed to socket-firewall November 24, 2026 03:15 — with GitHub Actions Inactive
# Conflicts:
#	CHANGELOG.md
#	docs/ci-cd.md
@lelia
lelia merged commit a38c880 into main Nov 24, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants